<?php
	/**
	* Get Video List
	* return in Json format
	* @author trungdt
	* @since Oct 26, 2011
	*/
	if (!defined('EXPONENT')) exit('');
	
	$sql="SELECT {$db->prefix}videomodule_video.*, {$db->prefix}videomodule_cat.title cat_title 
		FROM 
			{$db->prefix}videomodule_video INNER JOIN 
			{$db->prefix}videomodule_cat
		ON 
			({$db->prefix}videomodule_video.cat_id = {$db->prefix}videomodule_cat.id) AND ({$db->prefix}videomodule_video.location_data = {$db->prefix}videomodule_cat.location_data)
		
		WHERE {$db->prefix}videomodule_video.location_data = '".serialize($loc)."'
		
		ORDER BY postdate DESC
			
	 ";
	
	$data=$db->selectObjectsBySql($sql);
	
	foreach ($data as $k=>$v)
	{
		$v->postdate_text = date('F j, Y, H:i:s',$v->postdate);
	}
	echo json_encode($data);
	
	die();
?>